package com.ntt.benew.dictionary.entity.gpt

import android.os.Parcel
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName

@Keep
data class ChunkingEntity(
    val text: String? = null,
    val type: String? = null,
    @field:SerializedName("type_translation")
    val translation: String? = null,
    @field:SerializedName("chunk_breakdown")
    val breakdown: String? = null,
    var isSelected : Boolean = false
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readByte() != 0.toByte()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(text)
        parcel.writeString(type)
        parcel.writeString(translation)
        parcel.writeString(breakdown)
        parcel.writeByte(if (isSelected) 1 else 0)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<ChunkingEntity> {
        override fun createFromParcel(parcel: Parcel): ChunkingEntity {
            return ChunkingEntity(parcel)
        }

        override fun newArray(size: Int): Array<ChunkingEntity?> {
            return arrayOfNulls(size)
        }
    }
}